# $Id: PKGBUILD 78261 2012-10-17 10:27:32Z allan $
# Maintainer: Andrea Scarpino <andrea@archlinux.org>
# Contributor: examon <examon.mail[at]gmail[dot]com>
# Contributor: Sebastian Wiesner <lunaryorn googlemail com>
# Contributor: Dwight Schauer <dschauer@ti.com>

pkgbase=pyudev
pkgname=('python-pyudev' 'python2-pyudev')
pkgver=0.16.1
pkgrel=2
arch=('any')
url='http://pyudev.readthedocs.org/en/latest/index.html'
license=('LGPL')
makedepends=('python-distribute' 'python2-distribute')
optdepends=('python2-pyqt: PyQt integration'
            'python2-gobject2: Glib integration'
            'wxpython: WX integration')
source=("http://pypi.python.org/packages/source/p/pyudev/pyudev-${pkgver}.tar.gz")
md5sums=('4034de584b6d9efcbfc590a047c63285')

build() {
  cp -rf "${srcdir}/${pkgbase}-${pkgver}" "${srcdir}/python2-${pkgbase}-${pkgver}"
}

package_python-pyudev() {
  pkgdesc='A pure Python 3.x binding to libudev'
  depends=('python' 'udev')
  optdepends=('pyqt: PyQt integration'
              'python-gobject2: Glib integration')
  replaces=('pyudev')
  conflicts=('pyudev')
  provides=('pyudev')
  
  cd ${pkgbase}-${pkgver}
  python3 setup.py install --root "${pkgdir}" --optimize=1
}

package_python2-pyudev() {
  pkgdesc='A pure Python 2.x binding to libudev'
  depends=('python2' 'udev')
  optdepends=('python2-pyqt: PyQt integration'
              'python2-gobject2: Glib integration'
              'wxpython: WX integration')
  replaces=('python2-udev')
  conflicts=('python2-udev')
  provides=('python2-udev')
  
  cd python2-${pkgbase}-${pkgver}
  python2 setup.py install --root "${pkgdir}" --optimize=1
}
